<?php

namespace App\Http\Controllers\home;

use App\User;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\DB;

class myController extends Controller
{
    function changePass(){
        return view("home/changePass");
    }

    function myFollow(Request $request){
        $username = $request->session()->get("username");
        $user = User::where("user",$username)->first();
        $allApps = DB::table('groups')
            ->join('group_apps', 'group_apps.GID', '=', 'groups.GID')
            ->join('apps', 'apps.AID', '=', 'group_apps.AID')
            ->where("group_apps.GID",$user->GID)
            ->select('apps.*')
            ->get();
        return view("home/myFollow",compact('allApps'));
    }

    function myWords(){
        return view("home/myWords");
    }
}
